//运行结果：
// ConcreteImplementorA's operationImpl
// ConcreteImplementorB's operationImpl
public abstract class Abstraction {
    protected Implementor impl;

    public Abstraction(Implementor impl) {
        this.impl = impl;
    }

    public abstract void operation();
}
public class RefinderAbstraction extends Abstraction {
    public RefinderAbstraction(Implementor impl) {
        super(impl);
    }

    @Override
    public void operation() {
        impl.operationImpl();
    }
}
public interface Implementor {
    void operationImpl();
}
public class ConcreteImplementorA implements Implementor {
    @Override
    public void operationImpl() {
        System.out.println("ConcreteImplementorA's operationImpl");
    }
}
public class ConcreteImplementorB implements Implementor {
    @Override
    public void operationImpl() {
        System.out.println("ConcreteImplementorB's operationImpl");
    }
}
public class Client {
    public static void main(String[] args) {
        Implementor implementorA = new ConcreteImplementorA();
        Abstraction abstractionA = new RefinderAbstraction(implementorA);
        abstractionA.operation();

        Implementor implementorB = new ConcreteImplementorB();
        Abstraction abstractionB = new RefinderAbstraction(implementorB);
        abstractionB.operation();
    }
}